﻿namespace Devonline.Entity;

/// <summary>
/// 字符串类型的默认基类
/// </summary>
[Table("key_value_pair"), DisplayName("键值对")]
public class KeyValuePair : EntitySetWithKeyValuePair<string> { }

/// <summary>
/// 键值对存储数据的基类
/// epplus 自动导出的列头仅支持 DisplayName 和 Description 特性
/// </summary>
public abstract class EntitySetWithKeyValuePair<TKey> : EntitySetWithCreate<TKey>, IEntitySetWithKeyValuePair<TKey> where TKey : IConvertible
{
    /// <summary>
    /// 序号
    /// </summary>
    [Column("index"), DisplayName("序号"), Excel]
    public virtual int Index { get; set; }
    /// <summary>
    /// 键
    /// </summary>
    [Column("key"), DisplayName("键"), Required, MaxLength(128), Excel]
    public virtual string? Key { get; set; }
    /// <summary>
    /// 值
    /// </summary>
    [Column("value"), DisplayName("值"), Required, MaxLength(256), Excel]
    public virtual string? Value { get; set; }
}